home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -serious- / programming / other / sx4amiga / flashing_leds.lst < prev    next >
File List  |  2000-01-27  |  11KB  |  260 lines

  1. #PIC V1.0 (c)1997 J.Petroglou    LIST FILE
  2. #file: flashing_leds.asm
  3. #date: Mon Jan 10 15:59:51 2000
  4. #pic : PIC16C57
  5. ADDR CODE     SRCLINE SOURCECODE
  6.  
  7. 0000             000001 ;FLASHING LEDS
  8. 0000             000002 ;Example code for SX28 processor
  9. 0000             000003 ;This code flashes leds on and off on all I/O lines (RA,RB,RC)
  10. 0000             000004 
  11. 0000             000005 ;PROCESSOR=SX28AC
  12. 0000             000006 ;FUSE=0xE0B
  13. 0000             000007 ;FUSEX=0xFFF
  14. 0000             000008 
  15. 0000             000009 
  16. 0000             000010 ;NOTE1:  The processor,fuse and fusex settings are not taken over by the programmer
  17. 0000             000011 ;        but must be entered manually on programming time
  18. 0000             000012 
  19. 0000             000013 ;NOTE2:  The programmer will ignore bits 11:7 of FUSEX. ITis therefore perfectly
  20. 0000             000014 ;        possible that a value different from the one you specified will be
  21. 0000             000015 ;        programmed into the SX chip.
  22. 0000             000016 
  23. 0000             000017 
  24. 0000             000018 
  25. 0000             000019 
  26. 0000             000020 ;Variables
  27. 0000             000021 
  28. 0000             000022 countA          equ 0x08
  29. 0000             000023 countB          equ 0x09
  30. 0000             000024 
  31. 0000             000025 
  32. 0000             000026 
  33. 0000             000027 
  34.  
  35. #include 'SX.inc' start
  36. 0000             000001 ;Include File for the SX chips form Scenix
  37. 0000             000002 ;for use with PicASM from the Apic package
  38. 0000             000003 ;It sets the processor to PIC16C57 which is (almost) code-compatible
  39. 0000             000004 ;
  40. 0000             000005 ;(12-bit CORE)
  41. 0000             000006 
  42. 0000             000007 
  43. 0000             000008 ;W and F contstants
  44. 0000             000009 
  45. 0000             000010 W EQU     H'0000'
  46. 0000             000011 F EQU     H'0001'
  47. 0000             000012 
  48. 0000             000013 ;Special Function Registers
  49. 0000             000014 
  50. 0000             000015 INDF        equ     0x00
  51. 0000             000016 RTCC        equ     0x01
  52. 0000             000017 PC          equ     0x02
  53. 0000             000018 STATUS      equ     0x03
  54. 0000             000019 FSR         equ     0x04
  55. 0000             000020 RA          equ     0x05
  56. 0000             000021 RB          equ     0x06
  57. 0000             000022 RC          equ     0x07
  58. 0000             000023 
  59. 0000             000024 ;STATUS bits
  60. 0000             000025 
  61. 0000             000026 C           equ     0
  62. 0000             000027 DC          equ     1
  63. 0000             000028 Z           equ     2
  64. 0000             000029 NOT_PD      equ     3
  65. 0000             000030 NOT_TO      equ     4
  66. 0000             000031 PA0         equ     5
  67. 0000             000032 PA1         equ     6
  68. 0000             000033 PA2         equ     7
  69. 0000             000034 
  70. 0000             000035 ;OPTION bits
  71. 0000             000036 
  72. 0000             000037 PSO         equ     0
  73. 0000             000038 PS1         equ     1
  74. 0000             000039 PS2         equ     2
  75. 0000             000040 PSA         equ     3
  76. 0000             000041 RTE_ES      equ     4
  77. 0000             000042 RTS         equ     5
  78. 0000             000043 RTE_IE      equ     6
  79. 0000             000044 RTW         equ     7
  80. 0000             000045 
  81. 0000             000046 
  82. 0000             000047 
  83. 0000             000048 ;bank switch macro's
  84. 0000             000049 
  85. 0000             000050             macro   BANK0
  86. 0000             000051             bcf     STATUS,PA0
  87. 0000             000052             bcf     STATUS,PA1
  88. 0000             000053             endm
  89. 0000             000054 
  90. 0000             000055             macro   BANK1
  91. 0000             000056             bsf     STATUS,PA0
  92. 0000             000057             bcf     STATUS,PA1
  93. 0000             000058             endm
  94. 0000             000059 
  95. 0000             000060             macro   BANK2
  96. 0000             000061             bcf     STATUS,PA0
  97. 0000             000062             bsf     STATUS,PA1
  98. 0000             000063             endm
  99. 0000             000064 
  100. 0000             000065             macro   BANK3
  101. 0000             000066             bsf     STATUS,PA0
  102. 0000             000067             bsf     STATUS,PA1
  103. 0000             000068             endm
  104. 0000             000069 
  105. 0000             000071 
  106. 0000             000072             macro   mode
  107. 0000             000073             bcf     0x02,1  ;MODE
  108. 0000             000074             endm
  109. 0000             000075 
  110. 0000             000076             macro   ret
  111. 0000             000077             bcf     0x02,2  ;RET
  112. 0000             000078             endm
  113. 0000             000079 
  114. 0000             000080             macro   reti
  115. 0000             000081             bcf     0x02,3  ;RETI
  116. 0000             000082             endm
  117. 0000             000083 
  118. 0000             000085 
  119. 0000             000086         PROCESSOR   pic16c57
  120. 0000             000087 
  121. #include end.
  122.  
  123. 0000             000029 
  124. 0000             000030 
  125. 0000             000031 
  126. 0000             000032                 org     0x000
  127. 0000             000033 
  128. 0000 0C00        000034 Start           movlw   0x00                    ; set DDR/TRIS register
  129. 0001 0005        000035                 tris    RA                      ; (all ports output)
  130. 0002 0006        000036                 tris    RB
  131. 0003 0007        000037                 tris    RC
  132. 0004             000038 
  133. 0004 0C0F        000039 Loop            movlw   0x0f                    ; All I/O lines HIGH
  134. 0005 0025        000040                 movwf   RA
  135. 0006 0CFF        000041                 movlw   0xff
  136. 0007 0026        000042                 movwf   RB
  137. 0008 0CFF        000043                 movlw   0xff
  138. 0009 0027        000044                 movwf   RC
  139. 000A             000045 
  140. 000A 0911        000046                 call    Delay
  141. 000B             000047 
  142. 000B 0C00        000048                 movlw   0x00                    ; All I/O lines LOW
  143. 000C 0025        000049                 movwf   RA
  144. 000D 0026        000050                 movwf   RB
  145. 000E 0027        000051                 movwf   RC
  146. 000F             000052 
  147. 000F 0911        000053                 call    Delay
  148. 0010             000054 
  149. 0010 0A04        000055                 goto    Loop
  150. 0011             000056 
  151. 0011             000057 
  152. 0011             000058 
  153. 0011             000059 
  154. 0011             000060 
  155. 0011             000061 
  156. 0011             000062 
  157. 0011             000063 
  158. 0011             000064 
  159. 0011 0000        000065 Delay           nop                             ; Double Delay Loop
  160. 0012 02E9        000066                 decfsz  countB
  161. 0013 0A11        000067                 goto    Delay
  162. 0014             000068 
  163. 0014 02E8        000069                 decfsz  countA
  164. 0015 0A11        000070                 goto    Delay
  165. 0016             000071 
  166. 0016 0442        000072             bcf     0x02,2  ;RET
  167. 0017             000073 
  168. 0017             000074 
  169. 0017             000075 
  170. 0017             000076 
  171. 0017             000077 
  172. 0017             000078 
  173. 07FF             000079                 org     0x7ff                   ; RESET vector
  174. 07FF             000080 
  175. 07FF 0A00        000081                 goto    Start
  176. 0800             000082 
  177. 0800             000083 
  178. 0800             000084 
  179. 0800             000085 
  180.  
  181.  
  182. Used Symbols
  183. -----------------------------------------
  184. countA                           00000008
  185. countB                           00000009
  186. W                                00000000
  187. F                                00000001
  188. INDF                             00000000
  189. RTCC                             00000001
  190. PC                               00000002
  191. STATUS                           00000003
  192. FSR                              00000004
  193. RA                               00000005
  194. RB                               00000006
  195. RC                               00000007
  196. C                                00000000
  197. DC                               00000001
  198. Z                                00000002
  199. NOT_PD                           00000003
  200. NOT_TO                           00000004
  201. PA0                              00000005
  202. PA1                              00000006
  203. PA2                              00000007
  204. PSO                              00000000
  205. PS1                              00000001
  206. PS2                              00000002
  207. PSA                              00000003
  208. RTE_ES                           00000004
  209. RTS                              00000005
  210. RTE_IE                           00000006
  211. RTW                              00000007
  212. Start                            00000000
  213. Loop                             00000004
  214. Delay                            00000011
  215.  
  216.  
  217. Used Defines
  218. -----------------------------------------
  219.  
  220.  
  221. PROGRAM MEMORY USAGE TABLE:    '-' = not used  'X' = used
  222.  
  223. 0000 : XXXXXXXXXXXXXXXX XXXXXXX--------- ---------------- ----------------
  224. 0040 : ---------------- ---------------- ---------------- ----------------
  225. 0080 : ---------------- ---------------- ---------------- ----------------
  226. 00C0 : ---------------- ---------------- ---------------- ----------------
  227. 0100 : ---------------- ---------------- ---------------- ----------------
  228. 0140 : ---------------- ---------------- ---------------- ----------------
  229. 0180 : ---------------- ---------------- ---------------- ----------------
  230. 01C0 : ---------------- ---------------- ---------------- ----------------
  231. 0200 : ---------------- ---------------- ---------------- ----------------
  232. 0240 : ---------------- ---------------- ---------------- ----------------
  233. 0280 : ---------------- ---------------- ---------------- ----------------
  234. 02C0 : ---------------- ---------------- ---------------- ----------------
  235. 0300 : ---------------- ---------------- ---------------- ----------------
  236. 0340 : ---------------- ---------------- ---------------- ----------------
  237. 0380 : ---------------- ---------------- ---------------- ----------------
  238. 03C0 : ---------------- ---------------- ---------------- ----------------
  239. 0400 : ---------------- ---------------- ---------------- ----------------
  240. 0440 : ---------------- ---------------- ---------------- ----------------
  241. 0480 : ---------------- ---------------- ---------------- ----------------
  242. 04C0 : ---------------- ---------------- ---------------- ----------------
  243. 0500 : ---------------- ---------------- ---------------- ----------------
  244. 0540 : ---------------- ---------------- ---------------- ----------------
  245. 0580 : ---------------- ---------------- ---------------- ----------------
  246. 05C0 : ---------------- ---------------- ---------------- ----------------
  247. 0600 : ---------------- ---------------- ---------------- ----------------
  248. 0640 : ---------------- ---------------- ---------------- ----------------
  249. 0680 : ---------------- ---------------- ---------------- ----------------
  250. 06C0 : ---------------- ---------------- ---------------- ----------------
  251. 0700 : ---------------- ---------------- ---------------- ----------------
  252. 0740 : ---------------- ---------------- ---------------- ----------------
  253. 0780 : ---------------- ---------------- ---------------- ----------------
  254. 07C0 : ---------------- ---------------- ---------------- ---------------X
  255.  
  256. Program Memory Words Used:  0024
  257. Program Memory Words Free:  2024
  258.  
  259. Errors: 0
  260.